#include	<string.h>
#include	"MyIpmsg.h"

char * mystrtok (char * s, char * delim, size_t * olds)
{
	char 	* token;
	char 	* temp = (char *)*olds;
	
	if (s == NULL)
		s = temp;

	/* Scan leading delimiters.  */
	s += strspn (s, delim);
	if (*s == '\0') {
		temp = s;
		return NULL;
	}

	/* Find the end of the token.  */
	token = s;
	s = strpbrk (token, delim);
	if (s == NULL)
		/* This token finishes the string.  */
		temp = (char *) __rawmemchr (token, '\0');
	else {
		/* Terminate the token and make OLDS point past it.  */
		*s = '\0';
		temp = s + 1;
	}

	* olds = (size_t)temp;
	return token;
}
